package org.example.demo16_zhongjie;

public class UnitedNationsMediator implements UnitedNations {
    private WTO wto;
    private WFC wfc;
    private WHO who;

    public UnitedNationsMediator(WTO wto, WFC wfc, WHO who) {
        this.wto = wto;
        this.wfc = wfc;
        this.who = who;
    }

    @Override
    public void coordinate(String agency, String message) {
        if (agency.equals("WTO")) {
            wto.receiveMessage(message);
        } else if (agency.equals("WFC")) {
            wfc.receiveMessage(message);
        } else if (agency.equals("WHO")) {
            who.receiveMessage(message);
        }
    }
}
